package com.newway.back.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.newway.back.entity.SysMenuEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysMenuMapper extends BaseMapper<SysMenuEntity> {

    @Select(" select distinct sm.* from sys_user su inner join sys_user_role sur on su.id  = sur.user_id inner join sys_role sr on sur.role_id =sr.id\n" +
            "inner join sys_role_menu srm on srm.role_id =sr.id inner join sys_menu sm on sm.id = srm.menu_id\n" +
            "where su.id =#{id}  ")
    List<SysMenuEntity> selectMenuByUserId(@Param("id") Integer id);
}
